/**
 * MarioEnemy_BulletBillAI
 * @extends MarioAI
 * @version 2010.12.03
 */

class MarioEnemy_BulletBillAI extends MarioAI;

var Vector loc2;

state Patrolling
{
	/**
	 * SeePlayer
	 * @version 2010.12.03
	 */
	event SeePlayer(Pawn SeenPlayer)
	{
		if(playercontroller(SeenPlayer.controller) == None)
			return;

		thePlayer = SeenPlayer;
		`log("SEE YOU!");

		//move = !move; ? unrealscript might not like that...
		if(move == 0)
			move = 1;
	}

	Begin:	
	Pawn.MaxDesiredSpeed = 1.0f;
			
	if(move == 1)
	{
		loc  = thePlayer.Location;	
		loc2 = Pawn.GetPawnViewLocation();

		/*if(loc2.Y > loc2.X)
		{*/
			//if(thePlayer.Location.X < Pawn.Location.X || Pawn.Location.X == 0)
			//	loc.X = loc.X * -400;
			//else
			//	loc.X = loc.X * 400;
				//loc.X = -30;
		//}
		//else
		//{
			if(thePlayer.Location.Y < Pawn.Location.Y || Pawn.Location.Y == 0)
				//0-400?
				loc.Y = loc.Y * (0-400);
			else 
				loc.Y = loc.Y * 400;
				//loc.Y = -100;
		//}
			
		Pawn.MaxDesiredSpeed = 1.0;
			
		if(Loc.Y != thePlayer.Location.Y && thePlayer.Location.Y < Pawn.Location.Y && loc.Y > 0)
			loc.Y = loc.Y * -1;
		else if(Loc.X != thePlayer.Location.X && thePlayer.Location.X < Pawn.Location.X && loc.X > 0)
			loc.X = loc.X * -1;
			
		MoveTo(loc);

		//Is this like movestate you're changing?
		move = 2;			
	}
		
	//`log("LOC X:"$loc.X$" Y:"$loc.Y$" Z:"$loc.Z);
	LatentWhatToDoNext();
}

state Dead
{
	Begin:
	Pawn.Destroy();
}


